package com.leyou.job.task;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 定时任务类
 */
@Slf4j
//@Component
public class CleanOrderTask2 {

    private int i = 1;

    /**
     *  时间表达式：与 fixedDelay 一样
     */
    @Scheduled(cron = "0/2 * * * * ? ")
    public void cleanOrder1() throws InterruptedException {
        log.info("{}<======【乐优定时微服务cron】删除过期未支付的订单，并把库存还原！", i);
        if(i == 1){
            Thread.sleep(10000L);
        }
        i++;
    }

}
